<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>属性监听</title>
		<script src="https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/vue/2.6.14/vue.min.js"></script>

	</head>
	<body>
		<div id="app">
			计数器: {{count}}
			<input type="button" value="点击" @click="count++" />
		</div>

		<script>
			var app = new Vue({
				el: '#app',
				data() {
					return {
						count: 1
					}
				}
			});

			//监听vue中数据count的改变
			app.$watch("count", function(nval, oval) {
				alert("count的值发生变化了..., 原值:" + oval + " , 新值: " + nval);
			});
		</script>
	</body>
</html>
